package com.demo.juc;

import java.util.concurrent.BlockingQueue;
import java.util.concurrent.RejectedExecutionHandler;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;

public class MyThreadPoolExecutor extends ThreadPoolExecutor {

	public MyThreadPoolExecutor(int corePoolSize, int maximumPoolSize,
			long keepAliveTime, TimeUnit unit, BlockingQueue<Runnable> workQueue) {
		super(corePoolSize, maximumPoolSize, keepAliveTime, unit, workQueue);
	}

	public MyThreadPoolExecutor(int corePoolSize, int maximumPoolSize,
			long keepAliveTime, TimeUnit unit,
			BlockingQueue<Runnable> workQueue, RejectedExecutionHandler handler) {
		super(corePoolSize, maximumPoolSize, keepAliveTime, unit, workQueue,handler);
	};

	@Override
	protected void beforeExecute(Thread t, Runnable r) {
		System.out.println("当前线程:" + Thread.currentThread().getId() + "beforeExecute...");
	}

	@Override
	protected void afterExecute(Runnable r, Throwable t) {
		System.out.println("当前线程:" + Thread.currentThread().getId() + "afterExecute...");
	}

}
